Overwrite views

Hello,

i've a problem with views.
I've a script, witch go to all views from a module, load them, change something and save the view.
The problem is, at the end of the loop all views display the same. I realy dont know why. When I use my script only with one view it works fine, but when i use the loop for all views all views display the setting from the last view (of the loop).
Anyone an idea?
 

string s
for s in views matrixModule do {
load view s;
/*
do something (different for each view)
*/
save view s;
}

Tekka - Wed Feb 16 09:12:40 EST 2011

Re: Overwrite views
Tekka - Wed Feb 16 10:52:01 EST 2011

Solved it.
Thanks for reading!

Re: Overwrite views
Ian_F - Mon Aug 06 06:25:33 EDT 2012

Tekka - Wed Feb 16 10:52:01 EST 2011
Solved it.
Thanks for reading!

Hi,

I've encountered the same problem.

Please could you let me know what you determined the problem to be, and how you fixed it?
Cheers.

Re: Overwrite views
Mathias Mamsch - Mon Aug 06 07:39:12 EDT 2012

Ian_F - Mon Aug 06 06:25:33 EDT 2012
Hi,

I've encountered the same problem.

Please could you let me know what you determined the problem to be, and how you fixed it?
Cheers.

Try taking care of the current module.

current = ...
load view ... 
 
// do stuff
 
current = ...
save view ...

 


If that does not work, you need to post relevant parts of your code. Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Overwrite views
Ian_F - Mon Aug 06 08:40:11 EDT 2012

Mathias Mamsch - Mon Aug 06 07:39:12 EDT 2012

Try taking care of the current module.

current = ...
load view ... 
 
// do stuff
 
current = ...
save view ...

 


If that does not work, you need to post relevant parts of your code. Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Thanks Mathias- that seems to have worked.

All I changed was adding a second 'current = m' before the save.
 

for sViewName in views m do
{
    current = m 
        vView = view (sViewName)
        load(m,vView)
 
        if (sViewName == "Targets View")
        {
                set(vView, rmcda, "DB Admins")
                set(vView, r, null)                     
        }
 
        current = m  // Setting current module AGAIN here, cured the problem
        save(vView)
}

 


Don't understand WHY this causes the views to acquire all the same settings though(?)

 

Re: Overwrite views
llandale - Mon Aug 06 12:34:37 EDT 2012

Ian_F - Mon Aug 06 08:40:11 EDT 2012

Thanks Mathias- that seems to have worked.

All I changed was adding a second 'current = m' before the save.
 

for sViewName in views m do
{
    current = m 
        vView = view (sViewName)
        load(m,vView)
 
        if (sViewName == "Targets View")
        {
                set(vView, rmcda, "DB Admins")
                set(vView, r, null)                     
        }
 
        current = m  // Setting current module AGAIN here, cured the problem
        save(vView)
}

 


Don't understand WHY this causes the views to acquire all the same settings though(?)

 

The previous view may have layouts or attr-DXL that open other modules.

Re: Overwrite views
Mathias Mamsch - Mon Aug 06 14:02:57 EDT 2012

Ian_F - Mon Aug 06 08:40:11 EDT 2012

Thanks Mathias- that seems to have worked.

All I changed was adding a second 'current = m' before the save.
 

for sViewName in views m do
{
    current = m 
        vView = view (sViewName)
        load(m,vView)
 
        if (sViewName == "Targets View")
        {
                set(vView, rmcda, "DB Admins")
                set(vView, r, null)                     
        }
 
        current = m  // Setting current module AGAIN here, cured the problem
        save(vView)
}

 


Don't understand WHY this causes the views to acquire all the same settings though(?)

 

Well if your current module changed, then the view will be saved to a different module. However you should notice that to change access rights on a view, you probably do NOT need to load and save the view. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS